<?php

namespace App\Http\Requests\admin;

use App\Http\Requests\Request;

class AuserInsertRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'username'=>'required|unique:ausers|regex:/^[a-zA-Z0-9_]{5,18}$/',
            'password'=>'required'
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '用户名不能为空',
            'username.unique' => '用户名已存在',
            'username.regex' => '用户不合法(用户必须5-18位,不能使用特殊符号)',
            'password.required' => '密码不能为空'
        ];
        
    }
}
